﻿Imports System.IO

Public Class annonces
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try

            Using sr As New StreamReader(Me.MapPath("annonces.csv"))

                Dim ligne As String
                'Dim dt As DataTable

                Do
                    ligne = sr.ReadLine()

                    If Not (ligne Is Nothing) Then

                        Dim ligneSplitted As String()

                        ligneSplitted = ligne.Split(";")

                        Dim numEnregistrement As String = ligneSplitted(0)
                        Dim texteEnregistrement As String = ligneSplitted(1)
                        Dim courrielEnregistrement As String = ligneSplitted(2)
                        Dim villeEnregistrement As String = ligneSplitted(3)
                        Dim cpEnregistrement As String = ligneSplitted(4)
                        Dim idRegionEnregistrement As String = ligneSplitted(5)
                        Dim idCatEnregistrement As String = ligneSplitted(6)

                        'dt.C()

                        'gvAnnonces.DataSource = dt

                        gvAnnonces.DataBind()

                        Response.Write(numEnregistrement & " " & texteEnregistrement & " " & courrielEnregistrement & " " & villeEnregistrement & " " & cpEnregistrement & " " & idRegionEnregistrement & " " & idCatEnregistrement)
                        Response.Write("<br />")

                    End If

                Loop Until ligne Is Nothing

            End Using

        Catch ex As Exception
            lError.Text = "Le Fichier est introuvable"
        End Try
    End Sub

End Class